[IMP] awesomeclicker: add editor metadata in Python file#1173
[IMP] awesomeclicker: add editor metadata in Python file#1173jupao-odoo wants to merge 6 commits intoodoo:19.0from
Conversation
Added a new line 'editor': "jupao" in the module code to indicate the editor used for this script. This helps with code clarity and consistency within the module.
- Initialize module structure - Create estate.property model - Add basic fields and attributes - Add security access rules - Add action and menus for UI
Add custom views for the `estate.property` model to improve user interface and data interaction. The commit introduces: - A list view showing key fields: name, postcode, bedrooms, living area, expected price, selling price, and available date. - A form view with structured groups and a notebook for detailed information including description, property features, and reserved fields like active and state. - A search view with filters and group-by options to easily find and categorize properties, including an "Available" filter for new and offer_received properties, and a group-by on postcode. This improves the usability of the real estate module, replacing default auto-generated views with tailored ones that match business requirements. Closes task-6
ltinel
left a comment
There was a problem hiding this comment.
Great work :)
FYI, if you scroll to the bottom of your PR, you'll find some Runbot links, among which the ci/style check. In there, you'll find a few styling suggestions (typically incorrect use of whitespace or newlines). Could you implement those to make the check pass?
| """, | ||
|
|
||
| 'author': "Odoo", | ||
| 'editor': "jupao", |
There was a problem hiding this comment.
No need for this change :) I guess it was just a test?
estate/models/estate_property.py
Outdated
|
|
||
| available_from = fields.Date( | ||
| copy=False, | ||
| default=lambda self: fields.Date.today() + timedelta(days=90) |
There was a problem hiding this comment.
We usually work with relativedelta (from dateutil.relativedelta import relativedelta):
| default=lambda self: fields.Date.today() + timedelta(days=90) | |
| default=lambda self: fields.Date.today() + relativedelta(months=3) |
| <field name="arch" type="xml"> | ||
| <search string="Property"> | ||
|
|
||
| <field name="name" string="Title"/> |
There was a problem hiding this comment.
Instead of overriding the string here (which is fine, by the way), you could also set it directly in the model (in the py file).
| 'summary': """ | ||
| Starting module for "Master the Odoo web framework, chapter 1: Build a new application" | ||
| """, | ||
|
|
||
| 'description': """ | ||
| Starting module for "Master the Odoo web framework, chapter 1: Build a new application" | ||
| """, |
estate/views/estate_menus.xml
Outdated
| <!-- Root Menu --> | ||
| <menuitem | ||
| id="estate_menu_root" | ||
| name="Real Estate"/> | ||
|
|
||
| <!-- First Level --> | ||
| <menuitem | ||
| id="estate_menu_properties" | ||
| name="Properties" | ||
| parent="estate_menu_root"/> | ||
|
|
||
| <!-- Action Menu --> | ||
| <menuitem | ||
| id="estate_menu_properties_action" | ||
| parent="estate_menu_properties" | ||
| action="estate_property_action"/> |
There was a problem hiding this comment.
If you nest the menu items, you won't need to explicitly specify a parent anymore.
| 'category': 'Tutorials', | ||
| 'version': '0.1', | ||
| 'application': True, | ||
| 'installable': True, |
There was a problem hiding this comment.
FYI, I believe this is the default, so you don't strictly need to specify it.
| Starting module for "Master the Odoo web framework, chapter 1: Build a new application" | ||
| """, | ||
|
|
||
| 'author': "Odoo", |
There was a problem hiding this comment.
In general, we put Odoo S.A. here, but it doesn't matter much in this context 😄
| 'views/estate_menus.xml' | ||
| ], | ||
|
|
||
| 'assets': {}, |
There was a problem hiding this comment.
Feel free to remove this since it's empty.
There was a problem hiding this comment.
This is your own config file, so it should probably stay local :) Maybe add it to your gitignore file to avoid including it in your PRs.
Introduce estate.property.type and estate.property.tag models. Extend estate.property with: - Many2one relation to property type - Many2many relation to property tags - One2many relation to property offers Add corresponding views and menus where required. Fix flake8 issues to satisfy ci/style checks.
- estate.property: * added total_area computed field (living_area + garden_area) * added best_price computed field (maximum of offer prices) * added @onchange on 'garden' to set default garden_area=10 and garden_orientation='north' - estate.property.offer: * added validity_date computed field (with inverse)
Chapter 9: link business logic to UI actions - estate.property: * Add "Cancel" and "Sold" buttons in form view header. * Enforce state constraints: a cancelled property cannot be sold and a sold property cannot be cancelled. * Raise UserError when state transitions are invalid. - estate.property.offer: * Add "Accept" and "Refuse" buttons. * Accepting an offer sets the buyer and selling price on the related property. * Only one offer can be accepted per property. - Updated views to include buttons in header sections. - Added Python methods implementing the business logic for these actions.
| 'estate.property', | ||
| string="Property", | ||
| required=True, | ||
| ondelete='cascade' |
There was a problem hiding this comment.
Good idea :) Although maybe not ideal in practice for tracking offers.
estate/views/estate_menus.xml
Outdated
| <menuitem | ||
| id="estate_menu_type" | ||
| name="Property Type" | ||
| parent="estate_menu_root"/> |
There was a problem hiding this comment.
I believe this menu item (and the "Property Tags" one) should be under a "Settings" menu item. But all of this would be simpler if you use nesting instead of the "parent" field :)
| <!-- Property Type Action --> | ||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Type</field> | ||
| <field name="res_model">estate.property.type</field> | ||
| <field name="view_mode">list,form</field> | ||
| </record> |
There was a problem hiding this comment.
Actions should be in the "_views" file of the corresponding record. (same below)
| <field name="expected_price"/> | ||
| <field name="selling_price"/> | ||
| <field name="available_from"/> | ||
| <field name="name" width="100px"/> |
There was a problem hiding this comment.
It's fine to set a width, but hardcoding pixels can be risky, since users can have different screen sizes (monitor, laptop, smartphone, ...)
|
|
||
| <group> | ||
| <group> | ||
| <field name="tag_ids" widget="many2many_tags"/> |
There was a problem hiding this comment.
Could you move this in the oe_title div?
| <list editable="bottom"> | ||
| <field name="price"/> | ||
| <field name="partner_id"/> | ||
| <field name="status"/> | ||
| </list> |
There was a problem hiding this comment.
No need for this :) You can put the editable="bottom" attribute directly in the list view of the offer (in estate/views/estate_property_offer_views.xml)
| <list editable="bottom"> | |
| <field name="price"/> | |
| <field name="partner_id"/> | |
| <field name="status"/> | |
| </list> |

Added a new line 'editor': "jupao" in the module code to indicate the editor used for this script. This helps with code clarity and consistency within the module.